package cn.edu.ujn.lab003.action;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

import cn.edu.ujn.lab003.model.Dlb;
import cn.edu.ujn.lab003.service.IDlService;

public class DlAction extends ActionSupport{
	private IDlService dlService;
	private Dlb dl;
	
	
	public IDlService getDlService() {
		return dlService;
	}
	public void setDlService(IDlService dlService) {
		this.dlService = dlService;
	}
	public Dlb getDl() {
		return dl;
	}
	public void setDl(Dlb dl) {
		this.dl = dl;
	}
	
	public String login() throws Exception{
		Dlb user = dlService.find(dl);
		if(user!=null) {
			Map<String, Object> session = ActionContext.getContext().getSession();
			session.put("user", user);
			return SUCCESS;
		}
		else
			return ERROR;
	}
	
}
